package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmMaterialDto;
import com.heima.wemedia.service.WmMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
//自媒体素材管理
@RestController
@RequestMapping("/api/v1/material")
public class WmMaterialController {

    @Autowired
    private WmMaterialService wmMaterialService;

    /**
     * TODO：素材上传
     * @param multipartFile
     * @return
     * @throws Exception
     */
    @PostMapping("/upload_picture")
    public ResponseResult uploadPicture(MultipartFile multipartFile) throws Exception {
        return wmMaterialService.uploadPicture(multipartFile);
    }

    /**
     * TODO:素材列表查询
     * @param multipartFilen
     * @throws Exception
     */
    @PostMapping("/list")
    public ResponseResult listPicture(WmMaterialDto wmMaterialDto) throws Exception {
        return wmMaterialService.listPicture(wmMaterialDto);
    }
}